<?php
  $link = mysql_connect('', 'admin_xbq', 'nihao')
      or die('Could not connect: ' . mysql_error());
  echo "Connected successfully\n";
  echo '<br /><br />';

  $query = "use test";
  $result = mysql_query($query) or die('Query failed: ' . mysql_error());
  $sql = "select * from staffroom where staffroom.sr_ID=".$_GET['sr_id'];
  $result = mysql_query($sql) or die('Query failed: ' . mysql_error());
  $line = mysql_fetch_array($result, MYSQL_ASSOC)
?>

<form action="edit_confirm2.php?sr_id=<?php echo $_GET['sr_id'];?>" method="post">
  <table align="center" width="400">
    <tr>
      <td class="style3">Staff room ID:</td>
      <td align="right" class="style3">
        <input width="100" name="id" type="text" value="<?php echo $line['sr_ID']; ?>"/>
      </td>
    </tr>
    <tr>
      <td class="style3">Department ID:</td>
      <td align="right" class="style3">
        <input width="100" name="depart_id" type="text" value="<?php echo $line['depart_ID']; ?>"/>
      </td>
    </tr>
    <tr>
      <td class="style3">Staff room's short name:</td>
      <td align="right" class="style3">
        <input name="short_name" type="text" value="<?php echo $line['sr_short_name']; ?>"/>
      </td>
    </tr>
    <tr>
      <td class="style3">Staff room's full name:</td>
      <td align="right" class="style3">
        <input  name="full_name" type="text" value="<?php echo $line['sr_full_name']; ?>"/>
      </td>
    </tr>
    <tr>
      <td class="style3">Head of staff room:</td>
      <td align="right" class="style3">
        <input name="head" type="text" value="<?php echo $line['sr_head_name']; ?>"/>
      </td>
    </tr>
    <tr>
      <td class="style3">Duty of staff room head:</td>
      <td align="right" class="style3">
        <select name="duty" value="<?php echo $line['sr_head_duty']; ?>">
          <option value="Professor"> Professor </option>
          <option value="Associate professor"> Associate professor </option>
          <option value="Old teacher"> Old teacher </option>
          <option value="Assistant"> Assistant </option>
        </select>
      </td>
    </tr>
    <tr>
      <td class="style3">Staff room phone:</td>
      <td align="right" class="style3">
        <input name="phone" type="text" value="<?php echo $line['phone']; ?>"/>
      </td>
    </tr>
    <tr>
      <td class="style3">Staff room e-mail:</td>
      <td align="right" class="style3">
        <input name="email" type="text" value="<?php echo $line['email']; ?>"/>
      </td>
    </tr>
    <tr>
      <td class="style3">Staff room homepage:</td>
      <td align="right" class="style3">
        <input name="page" type="text" value="<?php echo $line['sr_page']; ?>"/>
      </td>
    </tr>
    <tr>
      <td class="style3" align="right"><input name="add" type="button" value="Reset" /></td>
      <td align="left" class="style3"><input name="add" type="submit" value="Save" /></td>
    </tr>
  </table>
</form>
